﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using XCode;
using XCode.DataAccessLayer;

namespace BingZi.HY.Core.Entities.Center
{
	/// <summary>
	/// 分类信息
	/// </summary>
	[Serializable]
	[DataObject]
	[Description("分类信息")]
	[BindTable("app_Category", Description = "分类信息", ConnName = "Center", DbType = DatabaseType.SqlServer)]
	public partial class app_Category
	{
		#region 属性
		private Int32 _CategoryID;
		/// <summary>
		/// 分类ID号
		/// </summary>
		[Description("分类ID号")]
		[DataObjectField(true, true, false, 10)]
		[BindColumn(1, "CategoryID", "分类ID号", "", "int", 10, 0, false)]
		public Int32 CategoryID
		{
			get { return _CategoryID; }
			set { if (OnPropertyChange("CategoryID", value)) _CategoryID = value; }
		}

		private String _C_Name;
		/// <summary>
		/// 分类名
		/// </summary>
		[Description("分类名")]
		[DataObjectField(false, false, false, 50)]
		[BindColumn(2, "C_Name", "分类名", "", "nvarchar(50)", 0, 0, true)]
		public String C_Name
		{
			get { return _C_Name; }
			set { if (OnPropertyChange("C_Name", value)) _C_Name = value; }
		}

		private String _C_Pinyin;
		/// <summary>
		/// 分类拼音名
		/// </summary>
		[Description("分类拼音名")]
		[DataObjectField(false, false, false, 100)]
		[BindColumn(3, "C_Pinyin", "分类拼音名", "", "varchar(100)", 0, 0, false)]
		public String C_Pinyin
		{
			get { return _C_Pinyin; }
			set { if (OnPropertyChange("C_Pinyin", value)) _C_Pinyin = value; }
		}

		private Int32 _C_ParentID;
		/// <summary>
		/// 上级分类
		/// </summary>
		[Description("上级分类")]
		[DataObjectField(false, false, false, 10)]
		[BindColumn(4, "C_ParentID", "上级分类", "0", "int", 10, 0, false)]
		public Int32 C_ParentID
		{
			get { return _C_ParentID; }
			set { if (OnPropertyChange("C_ParentID", value)) _C_ParentID = value; }
		}

		private Int32 _C_ShowOrder;
		/// <summary>
		/// 显示顺序
		/// </summary>
		[Description("显示顺序")]
		[DataObjectField(false, false, false, 10)]
		[BindColumn(5, "C_ShowOrder", "显示顺序", "0", "int", 10, 0, false)]
		public Int32 C_ShowOrder
		{
			get { return _C_ShowOrder; }
			set { if (OnPropertyChange("C_ShowOrder", value)) _C_ShowOrder = value; }
		}

		private Int32 _C_Level;
		/// <summary>
		/// 当前分类所在层数
		/// </summary>
		[Description("当前分类所在层数")]
		[DataObjectField(false, false, false, 10)]
		[BindColumn(6, "C_Level", "当前分类所在层数", "0", "int", 10, 0, false)]
		public Int32 C_Level
		{
			get { return _C_Level; }
			set { if (OnPropertyChange("C_Level", value)) _C_Level = value; }
		}

		private Int32 _C_ChildCount;
		/// <summary>
		/// 当前分类子分类数
		/// </summary>
		[Description("当前分类子分类数")]
		[DataObjectField(false, false, false, 10)]
		[BindColumn(7, "C_ChildCount", "当前分类子分类数", "0", "int", 10, 0, false)]
		public Int32 C_ChildCount
		{
			get { return _C_ChildCount; }
			set { if (OnPropertyChange("C_ChildCount", value)) _C_ChildCount = value; }
		}

		private Int32 _C_State;
		/// <summary>
		/// 状态(0:未审;1:正常;2:锁定;3:删除)
		/// </summary>
		[Description("状态(0:未审;1:正常;2:锁定;3:删除)")]
		[DataObjectField(false, false, false, 3)]
		[BindColumn(8, "C_State", "状态(0:未审;1:正常;2:锁定;3:删除)", "", "tinyint", 3, 0, false)]
		public Int32 C_State
		{
			get { return _C_State; }
			set { if (OnPropertyChange("C_State", value)) _C_State = value; }
		}

		private String _C_Attribute;
		/// <summary>
		/// 分类属性(json)
		/// </summary>
		[Description("分类属性(json)")]
		[DataObjectField(false, false, true, -1)]
		[BindColumn(9, "C_Attribute", "分类属性(json)", "", "xml", 0, 0, false)]
		public String C_Attribute
		{
			get { return _C_Attribute; }
			set { if (OnPropertyChange("C_Attribute", value)) _C_Attribute = value; }
		}

		private String _C_Keyword;
		/// <summary>
		/// 关键字
		/// </summary>
		[Description("关键字")]
		[DataObjectField(false, false, true, 100)]
		[BindColumn(10, "C_Keyword", "关键字", "", "nvarchar(100)", 0, 0, true)]
		public String C_Keyword
		{
			get { return _C_Keyword; }
			set { if (OnPropertyChange("C_Keyword", value)) _C_Keyword = value; }
		}

		private String _C_Description;
		/// <summary>
		/// 分类描述
		/// </summary>
		[Description("分类描述")]
		[DataObjectField(false, false, true, 200)]
		[BindColumn(11, "C_Description", "分类描述", "", "nvarchar(200)", 0, 0, true)]
		public String C_Description
		{
			get { return _C_Description; }
			set { if (OnPropertyChange("C_Description", value)) _C_Description = value; }
		}
		#endregion

		#region 获取/设置 字段值
		/// <summary>
		/// 获取/设置 字段值。
		/// 一个索引，基类使用反射实现。
		/// 派生实体类可重写该索引，以避免反射带来的性能损耗
		/// </summary>
		/// <param name="name">字段名</param>
		/// <returns></returns>
		public override Object this[String name]
		{
			get
			{
				switch (name)
				{
					case "CategoryID" : return _CategoryID;
					case "C_Name" : return _C_Name;
					case "C_Pinyin" : return _C_Pinyin;
					case "C_ParentID" : return _C_ParentID;
					case "C_ShowOrder" : return _C_ShowOrder;
					case "C_Level" : return _C_Level;
					case "C_ChildCount" : return _C_ChildCount;
					case "C_State" : return _C_State;
					case "C_Attribute" : return _C_Attribute;
					case "C_Keyword" : return _C_Keyword;
					case "C_Description" : return _C_Description;
					default: return base[name];
				}
			}
			set
			{
				switch (name)
				{
					case "CategoryID" : _CategoryID = Convert.ToInt32(value); break;
					case "C_Name" : _C_Name = Convert.ToString(value); break;
					case "C_Pinyin" : _C_Pinyin = Convert.ToString(value); break;
					case "C_ParentID" : _C_ParentID = Convert.ToInt32(value); break;
					case "C_ShowOrder" : _C_ShowOrder = Convert.ToInt32(value); break;
					case "C_Level" : _C_Level = Convert.ToInt32(value); break;
					case "C_ChildCount" : _C_ChildCount = Convert.ToInt32(value); break;
					case "C_State" : _C_State = Convert.ToInt32(value); break;
					case "C_Attribute" : _C_Attribute = Convert.ToString(value); break;
					case "C_Keyword" : _C_Keyword = Convert.ToString(value); break;
					case "C_Description" : _C_Description = Convert.ToString(value); break;
					default: base[name] = value; break;
				}
			}
		}
		#endregion

		#region 字段名
		/// <summary>
		/// 取得分类信息字段名的快捷方式
		/// </summary>
		public class _
		{
			///<summary>
			/// 分类ID号
			///</summary>
			public const String CategoryID = "CategoryID";

			///<summary>
			/// 分类名
			///</summary>
			public const String C_Name = "C_Name";

			///<summary>
			/// 分类拼音名
			///</summary>
			public const String C_Pinyin = "C_Pinyin";

			///<summary>
			/// 上级分类
			///</summary>
			public const String C_ParentID = "C_ParentID";

			///<summary>
			/// 显示顺序
			///</summary>
			public const String C_ShowOrder = "C_ShowOrder";

			///<summary>
			/// 当前分类所在层数
			///</summary>
			public const String C_Level = "C_Level";

			///<summary>
			/// 当前分类子分类数
			///</summary>
			public const String C_ChildCount = "C_ChildCount";

			///<summary>
			/// 状态(0:未审;1:正常;2:锁定;3:删除)
			///</summary>
			public const String C_State = "C_State";

			///<summary>
			/// 分类属性(json)
			///</summary>
			public const String C_Attribute = "C_Attribute";

			///<summary>
			/// 关键字
			///</summary>
			public const String C_Keyword = "C_Keyword";

			///<summary>
			/// 分类描述
			///</summary>
			public const String C_Description = "C_Description";
		}
		#endregion
	}
}